feat: add contact card spam handler for all members#7
Open
rezhajulio wants to merge 4 commits intomainfrom
Open
feat: add contact card spam handler for all members#7rezhajulio wants to merge 4 commits intomainfrom
rezhajulio wants to merge 4 commits intomainfrom
Conversation
Block contact card (phone number) sharing for all non-admin members in monitored groups. Messages are deleted and a notification is sent to the warning topic. No restriction is applied. - Add has_contact() helper and handle_contact_spam() handler - Register handler in its own priority group (group=2) - Shift probation/duplicate/message handlers to groups 3/4/5 - Add CONTACT_SPAM_NOTIFICATION Indonesian template - Add 12 tests (531 total, all passing)
- Update handler descriptions and priority group numbers - Add contact card blocking to features list - Update test counts (519 → 531) - Add contact spam flow to mermaid workflow diagram - Update architecture section with new handler groups
- Add user restriction to contact spam handler (delete + restrict + notify) - Add CONTACT_SPAM_NOTIFICATION_NO_RESTRICT fallback template - Add tests for restrict behavior and restrict failure (533 total) - Update README mermaid diagram with restrict step - Update test counts in AGENTS.md and README.md
- Add contact_spam_restrict field to GroupConfig (default: true) - Add .env fallback in config.py and build_group_registry - Skip restrict in handler when config is false - Add to groups.json.example and .env.example - Add test for disabled restrict config (534 total) - Update docs with new config option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Block contact card (phone number) sharing for all non-admin members in monitored groups. Messages are deleted, users are restricted, and a notification is sent to the warning topic.
Changes
New handler:
handle_contact_spamHandler priority groups updated
Files changed
src/bot/handlers/anti_spam.py— Addedhas_contact()helper andhandle_contact_spam()handler with restrictsrc/bot/constants.py— AddedCONTACT_SPAM_NOTIFICATIONandCONTACT_SPAM_NOTIFICATION_NO_RESTRICTtemplatessrc/bot/main.py— Registered handler, updated group numberstests/test_anti_spam.py— 14 new tests (533 total, all passing)AGENTS.md/README.md— Updated docs, mermaid diagram with restrict stepTesting